package cn.edu.nwsuaf.teachercenter.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class UniqueKeyUtils {
	public static String getUniqueCode(){
		String result = "";
		Date date = new Date();
		SimpleDateFormat model = new SimpleDateFormat("yyyyMMddHHmmssSSS");
		int machineId = 1;
		int hashCodeV = UUID.randomUUID().toString().hashCode();
		if(hashCodeV<0){
			hashCodeV = -hashCodeV;
		}
		
		result = model.format(date)+machineId+String.format("%015d", hashCodeV);
		return result;
	}
}
